/// Options:
/// Date: 2025-11-03 11:38:21
/// Version: 8.91
/// Tip: To override a DTO option, remove "/" prefix before updating
/// BaseUrl: https://localhost:5001

/// GlobalNamespace: 
/// MakePropertiesOptional: False
/// AddServiceStackTypes: True
/// AddResponseStatus: False
/// AddImplicitVersion: 
/// AddDescriptionAsComments: True
//IncludeTypes: ChatCompletion.*
/// ExcludeTypes: 
/// DefaultImports: const std = @import("std");
///

const std = @import("std");


pub fn IReturn(comptime T: type) type {
    _ = T;
    return struct {
    };
}

pub const IPost = struct {
};

// @DataContract
pub const AiContent = struct {
    /// The type of the content part.
    // @DataMember(Name="type")
    type: []const u8,
};

/// The tool calls generated by the model, such as function calls.
// @DataContract
pub const ToolCall = struct {
    /// The ID of the tool call.
    // @DataMember(Name="id")
    id: []const u8,

    /// The type of the tool. Currently, only `function` is supported.
    // @DataMember(Name="type")
    type: []const u8,

    /// The function that the model called.
    // @DataMember(Name="function")
    function: []const u8,
};

/// A list of messages comprising the conversation so far.
// @DataContract
pub const AiMessage = struct {
    /// The contents of the message.
    // @DataMember(Name="content")
    content: ?[]AiContent,

    /// The role of the author of this message. Valid values are `system`, `user`, `assistant` and `tool`.
    // @DataMember(Name="role")
    role: []const u8,

    /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
    // @DataMember(Name="name")
    name: ?[]const u8,

    /// The tool calls generated by the model, such as function calls.
    // @DataMember(Name="tool_calls")
    tool_calls: ?[]ToolCall,

    /// Tool call that this message is responding to.
    // @DataMember(Name="tool_call_id")
    tool_call_id: ?[]const u8,
};

/// Parameters for audio output. Required when audio output is requested with modalities: [audio]
// @DataContract
pub const AiChatAudio = struct {
    /// Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16.
    // @DataMember(Name="format")
    format: []const u8,

    /// The voice the model uses to respond. Supported voices are alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, and shimmer.
    // @DataMember(Name="voice")
    voice: []const u8,
};

pub const ResponseFormat = enum {
    text,
    json_object,
};

// @DataContract
pub const AiResponseFormat = struct {
    /// An object specifying the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106.
    // @DataMember(Name="response_format")
    response_format: ResponseFormat,
};

pub const ToolType = enum {
    function,
};

// @DataContract
pub const Tool = struct {
    /// The type of the tool. Currently, only function is supported.
    // @DataMember(Name="type")
    type: ToolType,
};

// @DataContract
pub const ResponseError = struct {
    // @DataMember(Order=1)
    errorCode: []const u8,

    // @DataMember(Order=2)
    fieldName: []const u8,

    // @DataMember(Order=3)
    message: []const u8,

    // @DataMember(Order=4)
    meta: ?std.StringHashMap([]const u8),
};

// @DataContract
pub const ResponseStatus = struct {
    // @DataMember(Order=1)
    errorCode: []const u8,

    // @DataMember(Order=2)
    message: ?[]const u8,

    // @DataMember(Order=3)
    stackTrace: ?[]const u8,

    // @DataMember(Order=4)
    errors: ?[]ResponseError,

    // @DataMember(Order=5)
    meta: ?std.StringHashMap([]const u8),
};

/// Annotations for the message, when applicable, as when using the web search tool.
// @DataContract
pub const UrlCitation = struct {
    /// The index of the last character of the URL citation in the message.
    // @DataMember(Name="end_index")
    end_index: i32,

    /// The index of the first character of the URL citation in the message.
    // @DataMember(Name="start_index")
    start_index: i32,

    /// The title of the web resource.
    // @DataMember(Name="title")
    title: []const u8,

    /// The URL of the web resource.
    // @DataMember(Name="url")
    url: []const u8,
};

/// Annotations for the message, when applicable, as when using the web search tool.
// @DataContract
pub const ChoiceAnnotation = struct {
    /// The type of the URL citation. Always url_citation.
    // @DataMember(Name="type")
    type: []const u8,

    /// A URL citation when using web search.
    // @DataMember(Name="url_citation")
    url_citation: UrlCitation,
};

/// If the audio output modality is requested, this object contains data about the audio response from the model.
// @DataContract
pub const ChoiceAudio = struct {
    /// Base64 encoded audio bytes generated by the model, in the format specified in the request.
    // @DataMember(Name="data")
    data: []const u8,

    /// The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations.
    // @DataMember(Name="expires_at")
    expires_at: i32,

    /// Unique identifier for this audio response.
    // @DataMember(Name="id")
    id: []const u8,

    /// Transcript of the audio generated by the model.
    // @DataMember(Name="transcript")
    transcript: []const u8,
};

// @DataContract
pub const ChoiceMessage = struct {
    /// The contents of the message.
    // @DataMember(Name="content")
    content: []const u8,

    /// The refusal message generated by the model.
    // @DataMember(Name="refusal")
    refusal: ?[]const u8,

    /// The reasoning process used by the model.
    // @DataMember(Name="reasoning")
    reasoning: ?[]const u8,

    /// The role of the author of this message.
    // @DataMember(Name="role")
    role: []const u8,

    /// Annotations for the message, when applicable, as when using the web search tool.
    // @DataMember(Name="annotations")
    annotations: ?[]ChoiceAnnotation,

    /// If the audio output modality is requested, this object contains data about the audio response from the model.
    // @DataMember(Name="audio")
    audio: ?ChoiceAudio,

    /// The tool calls generated by the model, such as function calls.
    // @DataMember(Name="tool_calls")
    tool_calls: ?[]ToolCall,
};

// @DataContract
pub const Choice = struct {
    /// The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence, length if the maximum number of tokens specified in the request was reached, content_filter if content was omitted due to a flag from our content filters, tool_calls if the model called a tool
    // @DataMember(Name="finish_reason")
    finish_reason: []const u8,

    /// The index of the choice in the list of choices.
    // @DataMember(Name="index")
    index: i32,

    /// A chat completion message generated by the model.
    // @DataMember(Name="message")
    message: ChoiceMessage,
};

/// Usage statistics for the completion request.
// @DataContract
pub const AiCompletionUsage = struct {
    /// When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
    // @DataMember(Name="accepted_prediction_tokens")
    accepted_prediction_tokens: i32,

    /// Audio input tokens generated by the model.
    // @DataMember(Name="audio_tokens")
    audio_tokens: i32,

    /// Tokens generated by the model for reasoning.
    // @DataMember(Name="reasoning_tokens")
    reasoning_tokens: i32,

    /// When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion.
    // @DataMember(Name="rejected_prediction_tokens")
    rejected_prediction_tokens: i32,
};

/// Breakdown of tokens used in the prompt.
// @DataContract
pub const AiPromptUsage = struct {
    /// When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
    // @DataMember(Name="accepted_prediction_tokens")
    accepted_prediction_tokens: i32,

    /// Audio input tokens present in the prompt.
    // @DataMember(Name="audio_tokens")
    audio_tokens: i32,

    /// Cached tokens present in the prompt.
    // @DataMember(Name="cached_tokens")
    cached_tokens: i32,
};

/// Usage statistics for the completion request.
// @DataContract
pub const AiUsage = struct {
    /// Number of tokens in the generated completion.
    // @DataMember(Name="completion_tokens")
    completion_tokens: i32,

    /// Number of tokens in the prompt.
    // @DataMember(Name="prompt_tokens")
    prompt_tokens: i32,

    /// Total number of tokens used in the request (prompt + completion).
    // @DataMember(Name="total_tokens")
    total_tokens: i32,

    /// Breakdown of tokens used in a completion.
    // @DataMember(Name="completion_tokens_details")
    completion_tokens_details: ?AiCompletionUsage,

    /// Breakdown of tokens used in the prompt.
    // @DataMember(Name="prompt_tokens_details")
    prompt_tokens_details: ?AiPromptUsage,
};

/// Text content part
// @DataContract
pub const AiTextContent = struct {
    /// The text content.
    // @DataMember(Name="text")
    text: []const u8,
};

// @DataContract
pub const AiImageUrl = struct {
    /// Either a URL of the image or the base64 encoded image data.
    // @DataMember(Name="url")
    url: []const u8,
};

/// Image content part
// @DataContract
pub const AiImageContent = struct {
    /// The image for this content.
    // @DataMember(Name="image_url")
    image_url: AiImageUrl,
};

/// Audio content part
// @DataContract
pub const AiInputAudio = struct {
    /// URL or Base64 encoded audio data.
    // @DataMember(Name="data")
    data: []const u8,

    /// The format of the encoded audio data. Currently supports 'wav' and 'mp3'.
    // @DataMember(Name="format")
    format: []const u8,
};

/// Audio content part
// @DataContract
pub const AiAudioContent = struct {
    /// The audio input for this content.
    // @DataMember(Name="input_audio")
    input_audio: AiInputAudio,
};

/// File content part
// @DataContract
pub const AiFile = struct {
    /// The URL or base64 encoded file data, used when passing the file to the model as a string.
    // @DataMember(Name="file_data")
    file_data: []const u8,

    /// The name of the file, used when passing the file to the model as a string.
    // @DataMember(Name="filename")
    filename: []const u8,

    /// The ID of an uploaded file to use as input.
    // @DataMember(Name="file_id")
    file_id: ?[]const u8,
};

/// File content part
// @DataContract
pub const AiFileContent = struct {
    /// The file input for this content.
    // @DataMember(Name="file")
    file: AiFile,
};

// @DataContract
pub const ChatResponse = struct {
    /// A unique identifier for the chat completion.
    // @DataMember(Name="id")
    id: []const u8,

    /// A list of chat completion choices. Can be more than one if n is greater than 1.
    // @DataMember(Name="choices")
    choices: []Choice,

    /// The Unix timestamp (in seconds) of when the chat completion was created.
    // @DataMember(Name="created")
    created: i64,

    /// The model used for the chat completion.
    // @DataMember(Name="model")
    model: []const u8,

    /// This fingerprint represents the backend configuration that the model runs with.
    // @DataMember(Name="system_fingerprint")
    system_fingerprint: ?[]const u8,

    /// The object type, which is always chat.completion.
    // @DataMember(Name="object")
    object: []const u8,

    /// Specifies the processing type used for serving the request.
    // @DataMember(Name="service_tier")
    service_tier: ?[]const u8,

    /// Usage statistics for the completion request.
    // @DataMember(Name="usage")
    usage: AiUsage,

    /// Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format.
    // @DataMember(Name="metadata")
    metadata: ?std.StringHashMap([]const u8),

    // @DataMember(Name="responseStatus")
    responseStatus: ?ResponseStatus,
};

/// Chat Completions API (OpenAI-Compatible)
// @Route("/v1/chat/completions", "POST")
// @DataContract
pub const ChatCompletion = struct {
    /// The messages to generate chat completions for.
    // @DataMember(Name="messages")
    messages: []AiMessage,

    /// ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API
    // @DataMember(Name="model")
    model: []const u8,

    /// Parameters for audio output. Required when audio output is requested with modalities: [audio]
    // @DataMember(Name="audio")
    audio: ?AiChatAudio,

    /// Modify the likelihood of specified tokens appearing in the completion.
    // @DataMember(Name="logit_bias")
    logit_bias: ?std.StringHashMap(i32),

    /// Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format.
    // @DataMember(Name="metadata")
    metadata: ?std.StringHashMap([]const u8),

    /// Constrains effort on reasoning for reasoning models. Currently supported values are minimal, low, medium, and high (none, default). Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
    // @DataMember(Name="reasoning_effort")
    reasoning_effort: ?[]const u8,

    /// An object specifying the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. Setting Type to ResponseFormat.JsonObject enables JSON mode, which guarantees the message the model generates is valid JSON.
    // @DataMember(Name="response_format")
    response_format: ?AiResponseFormat,

    /// Specifies the processing type used for serving the request.
    // @DataMember(Name="service_tier")
    service_tier: ?[]const u8,

    /// A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
    // @DataMember(Name="safety_identifier")
    safety_identifier: ?[]const u8,

    /// Up to 4 sequences where the API will stop generating further tokens.
    // @DataMember(Name="stop")
    stop: ?[][]const u8,

    /// Output types that you would like the model to generate. Most models are capable of generating text, which is the default:
    // @DataMember(Name="modalities")
    modalities: ?[][]const u8,

    /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates.
    // @DataMember(Name="prompt_cache_key")
    prompt_cache_key: ?[]const u8,

    /// A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
    // @DataMember(Name="tools")
    tools: ?[]Tool,

    /// Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.
    // @DataMember(Name="verbosity")
    verbosity: ?[]const u8,

    /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
    // @DataMember(Name="temperature")
    temperature: ?f64,

    /// An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
    // @DataMember(Name="max_completion_tokens")
    max_completion_tokens: ?i32,

    /// An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.
    // @DataMember(Name="top_logprobs")
    top_logprobs: ?i32,

    /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
    // @DataMember(Name="top_p")
    top_p: ?f64,

    /// Number between `-2.0` and `2.0`. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
    // @DataMember(Name="frequency_penalty")
    frequency_penalty: ?f64,

    /// Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
    // @DataMember(Name="presence_penalty")
    presence_penalty: ?f64,

    /// This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend.
    // @DataMember(Name="seed")
    seed: ?i32,

    /// How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
    // @DataMember(Name="n")
    n: ?i32,

    /// Whether or not to store the output of this chat completion request for use in our model distillation or evals products.
    // @DataMember(Name="store")
    store: ?bool,

    /// Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.
    // @DataMember(Name="logprobs")
    logprobs: ?bool,

    /// Whether to enable parallel function calling during tool use.
    // @DataMember(Name="parallel_tool_calls")
    parallel_tool_calls: ?bool,

    /// Whether to enable thinking mode for some Qwen models and providers.
    // @DataMember(Name="enable_thinking")
    enable_thinking: ?bool,

    /// If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a `data: [DONE]` message.
    // @DataMember(Name="stream")
    stream: ?bool,
};
